import * as PIXI from 'pixi.js'
import param, { bgScale } from './param'

export default async (): Promise<PIXI.Sprite> => {
  const bundle = await PIXI.Assets.loadBundle('module')
  const sprite = new PIXI.Sprite(
    new PIXI.Texture({
      source: new PIXI.Texture(bundle.diyBg).source,
    }),
  )
  sprite.anchor.set(0.5)
  bgScale(param.value.width / sprite.width, param.value.height / sprite.height)
  sprite.scale.set(param.value.width / sprite.width, param.value.height / sprite.height)
  sprite.position.set(param.value.width / 2, param.value.height / 2)
  return sprite
}
